package com.workerhelping.feignClients;

import com.workerhelping.dto.*;
import com.workerhelping.po.*;
import com.workerhelping.result.Result;
import com.workerhelping.vo.LoginVo;
import com.workerhelping.vo.WorkerPortalVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient("MYSQL")
public interface MySQLFeignClient {
    /**
     * 保存用户
     *
     * @param worker
     * @return
     */
    @PostMapping("/worker/saveWorker")
    Result<String> saveWorker(@RequestBody Worker worker);


    /**
     * 通过手机号查找职工
     *
     * @param phoneNumDTO
     * @return
     */
    @PostMapping("/worker/getWorkerByPhoneNum")
    Result<Worker> getWorkerByPhoneNum(@RequestBody PhoneNumDTO phoneNumDTO);

    /**
     * 根据id查找职工
     *
     * @param workerIdDTO
     * @return
     */
    @PostMapping("/worker/getWorkerById")
    Result<Worker> getWorkerById(@RequestBody WorkerIdDTO workerIdDTO);


    /**
     * 查询所有致困原因
     *
     * @return
     */
    @PostMapping("/record/getAllStuckReasons")
    Result<List<StuckReason>> getAllStuckReasons();

    /**
     * 根据id查询用户档案信息视图对象
     *
     * @param workerIdDTO
     * @return
     */
    @PostMapping("/record/getRecordWithWorkerById")
    Result<WorkerPortalVO> getRecordWithWorkerById(@RequestBody WorkerIdDTO workerIdDTO);

    /**
     * 保存档案信息返回档案id
     *
     * @param record
     * @return
     */
    @RequestMapping("/record/insert")
    Result<Integer> insertRecord(@RequestBody Record record);

    /**
     * 更新职工空缺信息
     *
     * @param workerInfoDTO
     * @return
     */
    @PostMapping("/worker/updateWorkerInfo")
    Result<String> updateWorkerInfo(@RequestBody WorkerInfoDTO workerInfoDTO);

    /**
     * 更新至困原因与档案关系
     *
     * @param stuckReasonIdsDTO
     * @return
     */
    @PostMapping("/record/setRecordStuckReasonsRelation")
    Result<String> setRecordStuckReasonsRelation(@RequestBody StuckReasonIdsDTO stuckReasonIdsDTO);

    /**
     * 根据WorkerId查找档案
     *
     * @param workerIdDTO
     * @return
     */
    @PostMapping("/record/getRecordByWorkerId")
    Result<Record> getRecordByWorkerId(@RequestBody WorkerIdDTO workerIdDTO);

    /**
     * 根据RecordId查询相关联的至困原因id
     *
     * @param recordIdDTO
     * @return
     */
    @PostMapping("/record/getRecordStuckReasonByRecordId")
    Result<List<Integer>> getRecordStuckReasonByRecordId(@RequestBody RecordIdDTO recordIdDTO);

    /**
     * 申请更新档案信息
     *
     * @param record
     * @return
     */
    @PostMapping("/record/updateRecordByRecordId")
    Result<String> updateRecordByRecordId(@RequestBody Record record);

    /**
     * 删除档案与致困信息关联表中信息
     *
     * @param recordIdDTO
     * @return
     */
    @PostMapping("/record/deleteRecordStuckReasonByRecordId")
    Result<String> deleteRecordStuckReasonByRecordId(@RequestBody RecordIdDTO recordIdDTO);

    /**
     * 职工申请提交后，将档案信息修改为”未审核“
     *
     * @param workerStatusInfoDTO
     * @return
     */
    @PostMapping("/worker/updateWorkerStatusInfo")
    Result<String> updateWorkerStatusInfo(@RequestBody WorkerStatusInfoDTO workerStatusInfoDTO);


    /**
     * 得到管理员发送的消息
     *
     * @param workerIdDTO
     * @return
     */
    @PostMapping("/worker/getConfirmByWorkerId")
    Result<List<Confirm>> getConfirmByWorkerId(@RequestBody WorkerIdDTO workerIdDTO);

    /**
     * 逻辑删除
     *
     * @param workerIdDTO
     */
    @PostMapping("/worker/updateConfirmStatusByWorkerId")
    void updateConfirmStatusByWorkerId(@RequestBody WorkerIdDTO workerIdDTO);

    /**
     * 查询档案
     *
     * @return
     */
    @GetMapping(value = "/notice/search")
    Result<List<Notice>> search();


    /**
     * 根据id获取档案
     *
     * @param id
     * @return
     */
    @GetMapping("/notice/getNoticeById/{id}")
    Result<Notice> getNoticeById(@PathVariable("id") Integer id);

    @PostMapping("/worker/updateWorkerPswd")
    Result<String> updateWorkerPswd(@RequestBody Worker worker);

    /**
     * 消息置为已读
     * @param id
     * @return
     */
    @DeleteMapping("/worker/{id}")
    Result<String> deleteConfirmById(@PathVariable("id") Integer id);
}
